{% extends "personal_center/base.html" %}

{% block page_link %}
    <link rel="stylesheet" href="../../static/system_setup/css/style.css">
    <link rel="stylesheet" href="../../static/public_file/css/DepartmentSelection.css">
{% endblock %}


{% block style %}
    <style>
        .add_class {
            background: #1E90FF;
        }
        tr {
            height: 35px;
        }
        th {
            text-align: center;
        }
        {#tbody td{#}
        {#    overflow: hidden;white-space: nowrap;text-overflow: ellipsis;#}
        {# }#}
        {#td:first-child, th:first-child {#}
        {#    position: sticky;left: 0;z-index: 1;#}
        {#}#}
        thead tr th {
            position: sticky;top: 0;background-color: #E8E8E8;
        }

        th:first-child {
            z-index: 2;
        }
        #tb_1 tr:hover{
            background: #cfcfcf;
        }
        .top_tag {
            border-bottom: #01AAED solid 2px;color: #01AAED;
        }
        .tab_top {
            width: 100px;height: 40px;line-height: 40px;text-align: center;display: inline-block;cursor: pointer;
        }
        .file {
            position: relative;display: inline-block;background: #D0EEFF;border: 1px solid #99D3F5;border-radius: 4px;padding: 4px 12px;overflow: hidden;color: #1E88C7;text-decoration: none;text-indent: 0;line-height: 20px;
        }
        .file input {
            position: absolute;font-size: 100px;right: 0;top: 0;opacity: 0;
        }
        .file:hover {
            background: #AADFFD;border-color: #78C3F3;color: #004974;text-decoration: none;
        }
        .search {
            width: 300px;display: flex;float: right;margin: 10px 0;margin-right: 1%;
        }
        .search input {
            vertical-align: middle;float: left;height: 30px;width: 230px;outline: none;border: 1px solid #0070c1;box-sizing: border-box;border-bottom-left-radius: 3px;border-top-left-radius: 3px;
        }
        .search button {
            float: right;flex: 1;height: 30px;width: 70px;line-height: 30px;background-color: #0070c1;color: white;border-style: none;outline: none;border-bottom-right-radius: 3px;border-top-right-radius: 3px;
        }
        .search button i {
            font-style: normal;
        }
        .search button:hover {
            font-size: 16px;
        }
        .div_clase{
            display: inline-block;width: 300px;height: 30px;line-height: 30px;font-size: 14px;color: #0b0b0b;
        }
        #addForm {
            width: 800px;height: 620px;background: #F5F5F5;position: absolute;border: #dfdfdf solid 1px;margin: auto;border-radius: 3px;top: 50%;left: 50%;transform: translate(-50%, -50%);display: none;z-index: 10100;font-size: 0;
        }
        #title {
            display: flex;justify-content: space-between;box-sizing: border-box;padding: 0 10px;height: 50px;color: #0b0b0b;cursor: move;width: 100%;background: #f4f7fa;border-top-left-radius: 5px;border-top-right-radius: 5px;
        }
        #addForm1 {
            width: 800px;height: 620px;background: #F5F5F5;position: absolute;border: #dfdfdf solid 1px;margin: auto;border-radius: 3px;top: 50%;left: 50%;transform: translate(-50%, -50%);display: none;z-index: 10100;font-size: 0;
        }
        #addForm2 {
            width: 800px;height: 620px;background: #F5F5F5;position: absolute;border: #dfdfdf solid 1px;margin: auto;border-radius: 3px;top: 50%;left: 50%;transform: translate(-50%, -50%);display: none;z-index: 10100;font-size: 0;
        }
    </style>
{% endblock %}


{% block right_content %}
    <div id="new_issues" style="width: 100%;height: 100%;overflow: auto;background-color: white;">
        <div style="width: 100%;height: 40px;border-bottom: #cccccc solid 1px;">
            <div onclick="change_card('administrative')" id="administrative_tag" style="width: 100px;height: 100%;display: inline-block;line-height: 40px;text-align: center;" class="tab_top">院长办公会</div>
            <div onclick="change_card('party_committee')" id="party_committee_tag" style="width: 100px;height: 100%;display: inline-block;line-height: 40px;text-align: center;" class="tab_top top_tag">党委会</div>
            <div onclick="change_card('regular_meeting')" id="regular_meeting_tag" style="width: 100px;height: 100%;display: inline-block;line-height: 40px;text-align: center;" class="tab_top">行政例会</div>

            <div id="summit_div" style="width: 150px;height: 100%;line-height: 40px;text-align: center;float: right;padding-right: 2%;">
                <button id="summit_but" onclick="summit_data()" style="width: 100px;height: 30px;line-height: 30px;margin-top: 5px;background-color: #1E90FF;color: white;border: #1E90FF solid 1px;border-radius: 3px;">提&nbsp;&nbsp;交</button>
            </div>
            <div id="save_div" style="width: 100px;height: 100%;line-height: 40px;text-align: center;float: right;">
                <button id="save_but" onclick="save_data()" style="width: 100%;height: 30px;line-height: 30px;margin-top: 5px;background-color: #1E90FF;color: white;border: #1E90FF solid 1px;border-radius: 3px;">保&nbsp;&nbsp;存</button>
            </div>
        </div>

        <div id="party_committee" style="width: 100%;height: 92%;">
            <div style="width: 100%;height: 40px;line-height: 40px;text-align: center;">
                <h3 id="title——yiti" style="color: red;">党委会议题审批表</h3>
            </div>
            <hr>
            <div style="width: 100%;height: 93%;overflow: auto;margin-top: 0.5px;">
                <div style="width: 100%;">
                    <table style="width: 90%;margin-left: 5%;">
                        {% if received_obj %}
                            <tr style="width: 100%;margin-top: 20px;">
                                <td colspan="6" style="width: 100%;height: 40px;line-height: 40px;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;padding-right: 1%;">
                                    上级来文详情
                                </td>
                            </tr>
                            <tr style="width: 100%;">
                                <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    接收科室
                                </td>
                                <td style="width: 25%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;">{{ received_obj.apply_user.company.name }}</td>
                                <td style="width: 13%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    接收人
                                </td>
                                <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;">{{ received_obj.apply_user.real_name }}</td>
                                <td style="width: 12%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    收文编号
                                </td>
                                <td style="width: 20%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;outline: none;border-top: none;">{{ received_obj.recive_number }}</td>
                            </tr>
                            <tr style="width: 100%;">
                                <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    来文单位
                                </td>
                                <td colspan="5" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;">{{ received_obj.send_company }}</td>
                            </tr>
                            <tr style="width: 100%;">
                                <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    来文字号
                                </td>
                                <td colspan="5" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;">{{ received_obj.send_number }}</td>
                            </tr>
                            <tr style="width: 100%;">
                                <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    收文日期
                                </td>
                                <td colspan="5" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;">
                                    {{ received_obj.recive_time | date:"Y-m-d H:i" }}
                                </td>
                            </tr>
                            <tr style="width: 100%;">
                                <td style="width: 15%;height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题
                                </td>
                                <td colspan="5" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;">{{ received_obj.title }}</td>
                            </tr>
                            <tr style="width: 100%;">
                                <td style="width: 15%;height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    内&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;容
                                </td>
                                <td colspan="5" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;">{{ received_obj.content }}</td>
                            </tr>
                            <tr style="width: 100%;">
                                <td style="width: 15%;height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    标注文本
                                </td>
                                <td colspan="5" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;">{{ received_obj.annotated_text }}</td>
                            </tr>
                            <tr style="width: 100%;">
                                <td style="width: 15%;height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    时间期限
                                </td>
                                <td colspan="5" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;">{{ received_obj.time_limit }}</td>
                            </tr>
                            <tr style="width: 100%;">
                                <td style="width: 15%;height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注
                                </td>
                                <td colspan="5" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;">{{ received_obj.remarks }}</td>
                            </tr>
                        {% endif %}

                        <tr style="width: 100%;">
                            <td colspan="6" style="width: 100%;height: 40px;line-height: 40px;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;padding-right: 1%;">
                                申请详情
                            </td>
                        </tr>
                        <tr style="width: 100%;">
                            <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;letter-spacing: 2px;">提&nbsp;交&nbsp;人</td>
                            <td id="db_tjr" style="width: 25%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;">{{ realname }}</td>
                            <td style="width: 13%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;">提交科室</td>
                            <td id="db_tjks" style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;">{{ department }}</td>
                            <td style="width: 12%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;">议题编号</td>
                            <td id="db_bh" style="width: 20%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;">{{ db_Serial_number }}</td>
                        </tr>
                        <tr id="topic_pay_select" style="width: 100%;">
                            <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;"><span style="color: red;">* </span>议题类型</td>
                            <td id="topic_type" colspan="5" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;">
                                <select name="" id="topic_type_select" style="width: 100%;height: 100%;border: none;outline: none;" onchange="select_topic_type()">
                                    <option value="0">请选择议题类型</option>
                                    <option value="1">付款类</option>
                                    <option value="2">经济合同类</option>
                                    <option value="3">项目类</option>
                                    <option value="4">文件类</option>
                                    <option value="5">方案类</option>
                                    {% if zbb_flag == 'true' %}
                                        <option value="7">招标采购类</option>
                                    {% endif %}
                                    <option value="6">其他事项</option>
                                </select>
                            </td>
                            <td id="pay_type_title" style="width: 13%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;display: none;">付款类型</td>
                            <td id="pay_type" style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;display: none;">
                                <select name="" id="pay_type_select" style="width: 100%;height: 100%;border: none;outline: none;">
                                    <option value="0">请选择付款类型</option>
                                    <option value="1">合同付款</option>
                                    <option value="2">固定资产/维修维保付款</option>
                                    <option value="3">材料付款</option>
                                    <option value="4">餐补付款</option>
                                    <option value="5">学科经费</option>
                                    <option value="6">科研经费</option>
                                    <option value="7">一般付款</option>
                                    <option value="8">工会付款</option>
                                </select>
                            </td>

                            <td id="contract_type_title" style="width: 13%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;display: none;">合同类型</td>
                            <td id="contract_type" style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;display: none;">
                                <select name="" id="contract_type_select" style="width: 100%;height: 100%;border: none;outline: none;">
                                    <option value="0">请选择合同类型</option>
                                    <option value="1">服务类</option>
                                    <option value="2">货物类</option>
                                    <option value="3">工程类</option>
                                    <option value="4">其他类</option>
                                </select>
                            </td>

                            <td id="whether_outweigh_title" style="width: 12%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;display: none;">是否转党委会</td>
                            <td id="whether_outweigh" style="width: 20%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;display: none;">
                                <input type="radio" name="whether_outweigh_20" value="1"> 是
                                <input type="radio" name="whether_outweigh_20" value="0" style="margin-left: 10px;"> 否
                            </td>

                            <td id="WhetherBidTitle" style="width: 12%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;display: none;">是否招标</td>
                            <td id="WhetherBid" style="width: 20%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;display: none;">
                                <input type="radio" name="whether_bid_or_not" value="1"> 是
                                <input type="radio" name="whether_bid_or_not" value="0" style="margin-left: 10px;"> 否
                            </td>
                        </tr>
                        <tr id="payment_information" style="width: 100%;display: none;">
                            <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">收款单位</td>
                            <td id="Payee" style="width: 25%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true"></td>
                            <td style="width: 13%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">收款账号</td>
                            <td id="receiving_account" style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true"></td>
                            <td style="width: 12%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;">开户行</td>
                            <td id="opening_bank" style="width: 20%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;outline: none;" contenteditable="true"></td>
                        </tr>
                        <tr id="contract_countersigning_tr" style="width: 100%;display: none;">
                            <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">对方单位</td>
                            <td id="opposite_unit" style="width: 25%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true"></td>
                            <td style="width: 13%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">合同名称</td>
                            <td id="contract_name" style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true"></td>
                            <td style="width: 12%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;">合同编号</td>
                            <td id="contract_number" style="width: 20%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;outline: none;" contenteditable="true"></td>
                        </tr>

                        <tr id="payment_capitalization" style="width: 100%;display: none;">
                            <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;">申请金额</td>
                            <td id="application_amount" style="width: 25%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;outline: none;" onblur="change_daxie(this)" contenteditable="true"></td>
                            <td style="width: 13%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;">金额大写</td>
                            <td id="amount_words" style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;"></td>
                            <td style="width: 12%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;">经费来源</td>
                            <td style="width: 20%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;">
                                <select name="" id="funding_source" style="width: 100%;height: 100%;border: none;outline: none;">
                                    <option value="0">请选择经费来源</option>
                                    <option value="1">自有经费</option>
                                    <option value="2">学科经费</option>
                                    <option value="3">科研经费</option>
                                    <option value="4">财政拨款</option>
                                    <option value="5">贴息贷款</option>
                                    <option value="6">专项债券</option>
                                    <option value="7">工会经费</option>
                                </select>
                            </td>
                        </tr>
                    </table>

                    <table id="ybgh_no" style="width: 90%;margin-left: 5%;">
                        <tr style="width: 100%;">
                            <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;"><span style="color: red;">* </span>议题名称</td>
                            <td id="db_ytmc" style="width: 53%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true"></td>
                            <td style="width: 12%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">预估用时(分钟)</td>
                            <td id="db_ygys" style="width: 20%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true"></td>
                        </tr>
                    </table>
                    <table id="fenguan_yes" style="width: 90%;margin-left: 5%;display: none;">
                        <tr style="width: 100%;">
                            <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">分管领导</td>
                            <td id="" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;">
                                <select name="" id="fg_people" style="width: 100%;height: 100%;border: none;outline: none;">
                                    <option value="">请选择分管领导</option>
                                    {% for leader in leaders %}
                                        <option value="{{ leader.id }}">{{ leader.real_name }}</option>
                                    {% endfor %}
                                </select>
                            </td>
                        </tr>
                    </table>

                    <table id="xieban_kehsi" style="width: 90%;margin-left: 5%;">
                        <tr style="width: 100%;">
                            <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">协办科室</td>
                            <td id="dang_xieban" style="width: 25%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;" onclick="show_office_model()"></td>
                            <td id="ysje1" style="width: 13%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">预算金额(不超过)</td>
                            <td id="ysje" style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true"></td>
                            <td id="jfly1" style="width: 12%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">经费来源</td>
                            <td id="jfly" style="width: 20%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true"></td>
                        </tr>
                    </table>
                </div>
                <div style="width: 100%;">
                    <div onclick="jianshu_show()" style="width: 90%;height: 40px;line-height: 40px;margin-left: 5%;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;border-top: none;padding-right: 1%;cursor: pointer;font-size: 16px;">
                        一、议题简述
                    </div>

                    <div id="yt_js" style="width: 100%;display: none;">
                        <script id="editor" type="text/plain" style="width:94.9%;height:300px;margin-left: 5%;outline: none;"></script>
                    </div>
                    <div id="btns"></div>
                </div>
                <div id="zhengceyiju" style="width: 100%;">
                    <div onclick="yiju_show()" style="width: 90%;height: 40px;line-height: 40px;margin-left: 5%;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;border-top: none;padding-right: 1%;cursor: pointer;font-size: 16px;">
                        二、政策依据或调研论证情况
                    </div>

                    <div id="yt_yj" style="width: 100%;display: none;">
                        <script id="editor1" type="text/plain" style="width:94.9%;height:300px;margin-left: 5%;outline: none;"></script>
                    </div>
                    <div id="btns1"></div>
                </div>
                <div id="jiejuefangan" style="width: 100%;">
                    <div onclick="jiejuefangan_show()" style="width: 90%;height: 40px;line-height: 40px;margin-left: 5%;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;border-top: none;padding-right: 1%;cursor: pointer;font-size: 16px;">
                        三、拟供选择方案
                    </div>

                    <div id="jj_fa_yj" style="width: 100%;display: none;">
                        <script id="editor2" type="text/plain" style="width:94.9%;height:300px;margin-left: 5%;outline: none;"></script>
                    </div>
                    <div id="btns2"></div>
                </div>
                <div style="width: 100%;">
                    <div style="width: 90%;height: 40px;line-height: 40px;margin-left: 5%;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;border-top: none;border-bottom: none;padding-right: 1%;">
                        上传附件<span style="color: red;">(注: 议题附件、汇报PPT)</span>
                        <a href="javascript:;" class="file" style="vertical-align: top;margin-top: 5px;float: right;">
                            上传文件
                            <input type="file" name="party_main_body" id="party_main_body" onchange="upload_accessory('file1', 'party_main', 'party_main_body', 'db_bh')">
                        </a>
                    </div>
                    <table style="width: 90%;margin-left: 5%;">
                        <thead>
                            <tr>
                                <td style="width: 5%;border: #cccccc solid 1px;text-align: center;">序号</td>
                                <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">文件名称</td>
                                <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">文件大小</td>
                                <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">上传时间</td>
                                <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">上传人员</td>
                                <td style="width: 15%;border: #cccccc solid 1px;border-left: none;text-align: center;">操作</td>
                            </tr>
                        </thead>
                        <tbody style="overflow: auto;" id="party_main"></tbody>
                    </table>
                </div>
                {% if received_obj %}
                    <div style="width: 100%;">
                        <table style="width: 90%;margin-left: 5%;">
                            <tr style="width: 100%;">
                                <td colspan="6" style="width: 100%;height: 40px;line-height: 40px;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;padding-right: 1%;">
                                    上级来文审批详情
                                </td>
                            </tr>
                            {% if 'one' in received_audit_dic %}
                                <tr style="width: 100%;">
                                    <td style="width: 15%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 0.7%;border-top: none;letter-spacing: 4px;">
                                        {% if company_type == 'yb' %}
                                            医院办公室
                                        {% else %}
                                            党委办公室
                                        {% endif %}
                                    </td>
                                    <td style="width: 85%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                        {% for k,v in received_audit_dic.items %}
                                            {% if k == 'one' %}
                                                {% for item in v %}
                                                    {% if item.state != 'unaudit' %}
                                                        <div style="width: 100%;line-height: 20px;position: relative;">
                                                            <span>{{ item.state_display }}</span>
                                                            <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                        </div>
                                                        <div>
                                                            {% if item.signature_picture %}
                                                                <img src="{{ item.signature_picture }}" alt=""
                                                                     style="width: 150px; height: 60px;">
                                                            {% else %}
                                                                {{ item.audit_user }}
                                                            {% endif %}
                                                        </div>
                                                        <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                    {% endif %}
                                                {% endfor %}
                                            {% endif %}
                                        {% endfor %}
                                    </td>
                                </tr>
                            {% endif %}

                            {% if 'two' in received_audit_dic %}
                                <tr style="width: 100%;">
                                    <td style="width: 15%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;letter-spacing: 1px;">
                                        分&nbsp;&nbsp;管&nbsp;&nbsp;领&nbsp;&nbsp;导
                                    </td>
                                    <td style="width: 85%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                        {% for k,v in received_audit_dic.items %}
                                            {% if k == 'two' %}
                                                {% for item in v %}
                                                    {% if item.state != 'unaudit' %}
                                                        <div style="width: 100%;line-height: 20px;position: relative;">
                                                            {% if item.state_display != 'end' %}
                                                                <span>{{ item.state_display }}</span>
                                                            {% else %}
                                                                <span>完结</span>
                                                            {% endif %}
                                                            <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                        </div>
                                                        <div>
                                                            {% if item.signature_picture %}
                                                                <img src="{{ item.signature_picture }}" alt=""
                                                                     style="width: 150px; height: 60px;">
                                                            {% else %}
                                                                {{ item.audit_user }}
                                                            {% endif %}
                                                        </div>
                                                        <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                    {% endif %}
                                                {% endfor %}
                                            {% endif %}
                                        {% endfor %}
                                    </td>
                                </tr>
                            {% endif %}
                        </table>
                    </div>
                {% endif %}
            </div>
        </div>
    </div>

    <div id="selection-office" class="office-shade">
        <div id="office-model">
            <!-- 标题 -->
            <div id="office-title">
                <h5 style="line-height: 40px;width: 15%;margin-left: 1%;display: inline-block;font-size: 14px;">选择科室</h5>
                <span onclick="close_office_models()" style="float: right;line-height: 50px;padding-right: 2%;cursor: pointer;"><i class="iconfont icon-quchu"></i></span>
            </div>
            <hr>
            <div style="width: 55%;height: 350px;vertical-align: top;left: 0;display: inline-block;border-right: #cfcfcf solid 1px;">
                <div style="width: 100%;height: 50px;line-height: 50px;padding-left: 2%;">
                    <input id="search_data1" onkeydown="search_dep()" class="search-input" type="text" placeholder="搜索" autocomplete="off">
                </div>
                <div id="processed" style="width: 100%;height: 300px;overflow: auto;">
                    {% for company in company_list %}
                        <div style="width: 100%;height: 30px;line-height: 30px;font-size: 14px;color: #0b0b0b;">
                            <input class="check_box1" id="{{ company.id }}" type="checkbox" onclick="check_dep_ff('{{ company.name }}', '{{ company.id }}', false)"> {{ company.name }}
                        </div>
                    {% endfor %}
                </div>
            </div>

            <div style="width: 43%;height: 360px;vertical-align: top;left: 0;display: inline-block;">
                <div style="width: 100%;height: 50px;line-height: 50px;padding-left: 2%;font-size: 14px;">
                    已选择科室
                </div>
                <div id="processed_prople" style="width: 100%;height: 265px;overflow: auto;padding-left: 2%;">

                </div>
                <div style="width: 100%;height: 40px;text-align: center;">
                    <button onclick="summit_val()" style="border-radius: 2px;height: 30px;margin-top: 5px;border: #1E90FF solid 1px;background: #1E90FF;color: white;width: 80px;letter-spacing: 4px;font-size: 14px;">
                        提交
                    </button>
                    <button onclick="close_office_models()" style="border-radius: 2px;height: 30px;margin-top: 5px;border: #cfcfcf solid 1px;width: 80px;letter-spacing: 4px;margin-left: 15px;font-size: 14px;">
                        取消
                    </button>
                </div>
            </div>
        </div>
    </div>

    <div id="del_adjunct" style="z-index: 1000;position: fixed;background-color: rgba(36, 36, 36, 0.5);width: 100%;height: 100%;top: 0;left: 0;right: 0;bottom: 0;display: none;">
        <div style="top: 50%;left: 50%;width: 400px;height: 150px;background: white;transform:translate(-50%,-50%);border: #dfdfdf solid 1px;position: absolute;border-radius: 4px;">
            <div style="width: 100%;height: 100px;text-align: center;line-height: 100px;">请查看附件，删除无用的附件！</div>
            <hr>
            <div style="width: 100%;height: 50px;text-align: right;padding-right: 5%;">
                <button onclick="del_adjunct_button()" style="width: 50px;height: 30px;line-height: 30px;margin-top: 10px;background: #00a0e9;color: white;border-radius: 4px;border: #00a0e9 solid 1px;">确认</button>
            </div>
        </div>
    </div>
{% endblock %}

{% block script %}
    <script type="text/javascript" charset="utf-8" src="../../static/announcements/ueditor/1.4.3/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../static/announcements/ueditor/1.4.3/ueditor.all.js"> </script>
    <script type="text/javascript" charset="utf-8" src="../../static/announcements/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript" src="../../static/public_file/js/DepartmentSelection.js"></script>
    <script>
        window.onload = function () {
            document.getElementById("loading").style.display = "none";
            document.getElementById("personage").className = "add_class";
            document.getElementById("sponsor").className = "add-nav-active";
            permissions_validation();
        };
        const uuid = "{{ uuid | safe }}"

        const CompanyArray = [13, 3, 22, 80];
        const CompanyId = {{ CompanyId | safe }};
        if (CompanyArray.includes(CompanyId)){
            document.getElementById("fenguan_yes").style.display = "table";
         }

        function del_adjunct_button() {
            document.getElementById("del_adjunct").style.display='none';
        }

        var db_Serial_number = "{{ db_Serial_number | safe }}";
        var yb_Serial_number = "{{ yb_Serial_number | safe }}";
        var lh_Serial_number = "{{ lh_Serial_number | safe }}";

        var ue = UE.getEditor('editor');

        var ue1 = UE.getEditor('editor1');

        var ue2 = UE.getEditor('editor2');

        function close_models2() {
            document.getElementById("addForm1").style.display = "none";
        }

        function close_models3() {
            document.getElementById("addForm2").style.display = "none";
        }

        function show_model1() {
            document.getElementById("addForm1").style.display="table-row";
        }

        function show_model2() {
            document.getElementById("addForm2").style.display="table-row";
        }

        function do_cancel(id) {
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/topics_apply_cancel_view");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("id=" + id);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200) {
                            alert("作废成功");
                            location.reload();
                            {#window.location.href="/personal-center/topic_discussion.html";#}
                        } else {
                            alert(JsonDate["message"]);
                        }
                    }
                }
            };
        }

        function do_stop(id) {
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/topics_apply_stop_view");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("id=" + id);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200) {
                            alert("终止成功");
                            location.reload();
                            {#window.location.href="/personal-center/topic_discussion.html";#}
                        } else {
                            alert(JsonDate["message"]);
                        }
                    }
                }
            };
        }

        // 删除列表
        function deltr(){
            var tb = document.getElementById('my_mine_body');
            var rowNum=tb.rows.length;
            for (i=0;i<rowNum;i++) {
                tb.deleteRow(i);
                rowNum=rowNum-1;
                i=i-1;
            }
        }

        var company_list = {{ company_list | safe }};

        function change_card(tag_id) {
            if (tag_id === "party_committee"){
                if (!permissions['党委会']){
                    alert("您的访问权限不足!");
                    return false
                }
                document.getElementById("party_committee_tag").className = "tab_top top_tag";
                document.getElementById("regular_meeting_tag").className = "tab_top";
                document.getElementById("administrative_tag").className = "tab_top";
                document.getElementById("title——yiti").innerText="党委会议题审批表";
                document.getElementById("xieban_kehsi").style.display="table";
                document.getElementById("zhengceyiju").style.display="table";
                document.getElementById("jiejuefangan").style.display="table";
                document.getElementById("db_bh").innerText = db_Serial_number;
                document.getElementById("summit_but").setAttribute("onclick", "summit_data()");
                document.getElementById("save_but").setAttribute("onclick", "save_data()");
                document.getElementById("topic_pay_select").style.display="none";
                {#document.getElementById("ybgh_no").style.display="none";#}
            }else if (tag_id === "administrative"){
                if (!permissions['院长办公会']){
                    alert("您的访问权限不足!");
                    return false
                }
                document.getElementById("administrative_tag").className = "tab_top top_tag";
                document.getElementById("regular_meeting_tag").className = "tab_top";
                document.getElementById("party_committee_tag").className = "tab_top";
                document.getElementById("title——yiti").innerText="院长办公会议题审批表";
                document.getElementById("xieban_kehsi").style.display="table";
                document.getElementById("zhengceyiju").style.display="table";
                document.getElementById("jiejuefangan").style.display="table";
                document.getElementById("db_bh").innerText = yb_Serial_number;
                document.getElementById("summit_but").setAttribute("onclick", "summit_data1()");
                document.getElementById("save_but").setAttribute("onclick", "save_data1()");
                document.getElementById("topic_pay_select").style.display="table-row";
                {#document.getElementById("ybgh_yes").style.display="none";#}
            }else {
                if (!permissions['行政例会']){
                    alert("您的访问权限不足!");
                    return false
                }
                document.getElementById("regular_meeting_tag").className = "tab_top top_tag";
                document.getElementById("administrative_tag").className = "tab_top";
                document.getElementById("party_committee_tag").className = "tab_top";
                document.getElementById("title——yiti").innerText="行政例会议题审批表";
                document.getElementById("xieban_kehsi").style.display="none";
                document.getElementById("zhengceyiju").style.display="none";
                document.getElementById("jiejuefangan").style.display="none";
                document.getElementById("db_bh").innerText = lh_Serial_number;
                document.getElementById("summit_but").setAttribute("onclick", "summit_data2()");
                document.getElementById("save_but").setAttribute("onclick", "save_data2()");
                document.getElementById("topic_pay_select").style.display="none";
                {#document.getElementById("ybgh_no").style.display="table";#}
                {#document.getElementById("ybgh_yes").style.display="none";#}
            }
        }

        function summit_val() {
            var processed_prople = document.getElementsByClassName("selected-department");
            {#if (processed_prople.length === 0){#}
            {#    alert("请选择拟稿科室！");#}
            {#    return false#}
            {# }#}
            var dep_list=[];
            for (var i=0; i<processed_prople.length; i++) {
                dep_list.push(processed_prople[i].innerText)
            }
            document.getElementById("dang_xieban").innerText=dep_list.join();
            close_office_models();
        }

        function summit_val1() {
            var cleck_box_list1 = document.getElementsByClassName("check_box1");
            var xuanzhong1 = ""
            for (var t=0; t<cleck_box_list1.length; t++){
                if (cleck_box_list1[t].checked){
                    xuanzhong1 = xuanzhong1+cleck_box_list1[t].id+", "
                }
            }
            document.getElementById("yb_xieban").innerText=xuanzhong1.slice(0, -2);
            document.getElementById("addForm1").style.display = "none";
        }

        function summit_val2() {
            var cleck_box_list2 = document.getElementsByClassName("check_box2");
            var xuanzhong2 = ""
            for (var t=0; t<cleck_box_list2.length; t++){
                if (cleck_box_list2[t].checked){
                    xuanzhong2 = xuanzhong2+cleck_box_list2[t].id+", "
                }
            }
            document.getElementById("lh_xieban").innerText=xuanzhong2.slice(0, -2);
            document.getElementById("addForm2").style.display = "none";
        }

        function search_dep() {
            var company_list = {{ company_list | safe }};
            var search_keyword = document.getElementById("search_data1").value;
            var processed = document.getElementById("processed");
            processed.innerHTML = "";
            for (var h=0; h<company_list.length; h++){
                if (company_list[h]["name"].indexOf(search_keyword) !== -1){
                    console.log(company_list[h]["name"])
                    var div_tag = document.createElement("div");div_tag.className="div_clase";
                    div_tag.innerHTML = '<input class="check_box1" id="'+company_list[h]["id"]+'" type="checkbox" onclick="check_dep_ff(\''+company_list[h]["name"]+'\', \''+company_list[h]["id"]+'\', false)"> '+ company_list[h]["name"];
                    processed.appendChild(div_tag)
                }
            }
        }

        function summit_data() {
            var db_ytmc = document.getElementById("db_ytmc").innerText;       // 议题名称
            var db_bh = document.getElementById("db_bh").innerText;       // 议题编号
            var db_xb = document.getElementById("dang_xieban").innerText;       // 协办科室
            var db_ytnr = btoa(encodeURI(UE.getEditor("editor").getContent()));       // 议题内容
            var db_ytyj = btoa(encodeURI(UE.getEditor("editor1").getContent()));       // 议题依据
            var db_jjfa = btoa(encodeURI(UE.getEditor("editor2").getContent()));       // 解决方案
            var db_ygys = document.getElementById("db_ygys").innerText;       // 预估用时(分钟)
            var ysje = document.getElementById("ysje").innerText;       // 预算金额
            var jfly = document.getElementById("jfly").innerText;       // 经费来源
            {#var audit_result = $("input[type=radio][name=yb_gh]:checked").val();            // 是否经过院长办公会#}
            var nr_wenben = UE.getEditor("editor").getPlainTxt();
            var yj_wenben = UE.getEditor("editor1").getPlainTxt();
            var fa_wenben = UE.getEditor("editor2").getPlainTxt();
            var myselect = document.getElementById("fg_people");
            var index = myselect.selectedIndex;
            var fg_people = myselect.options[index].value;
            if (CompanyId in [13, 3, 22]){
                if (!fg_people){
                    alert("请选择分管领导！");
                    return false
                }
            }
            if (!db_ytmc){
                alert("议题名称不能为空");
                return false
             }
            if (!db_ytnr){
                alert("议题内容不能为空");
                return false
             }
            if (!db_jjfa){
                alert("解决方案不能为空");
                return false
             }
            var table = document.getElementById('party_main');
            if (!table.children.length){
                alert("请上传议题文件！");
                return false
             }

            var db_xb_split = db_xb.split(',');var db_xb_list = [];
            if (db_xb_split.length >= 1){
                for (var a=0; a<db_xb_split.length; a++){
                    if (db_xb_split[a].trim()){
                        db_xb_list.push(db_xb_split[a].split("(")[1].slice(0, -1));
                    }
                }
             }

            var db_send_str = 'number='+String(db_bh)+'&type='+String("db")+'&topics_name='+String(db_ytmc)+'&topics_text='+String(db_ytnr)+'&topics_basis='+String(db_ytyj)+'&solution='+String(db_jjfa)+'&help_department='+JSON.stringify(db_xb_list)+'&topics_estimate='+String(db_ygys)+"&nr_wenben="+String(nr_wenben)+"&yj_wenben="+String(yj_wenben)+"&fa_wenben="+String(fa_wenben)+"&fg_people="+String(fg_people)+"&ysje="+String(ysje)+"&jfly="+String(jfly) + "&uuid=" + String(uuid);
            ajax_request(db_send_str);
        }

        function summit_data1() {
            var yb_ytmc = document.getElementById("db_ytmc").innerText;       // 议题名称
            var yb_bh = document.getElementById("db_bh").innerText;       // 议题编号
            var yb_xb = document.getElementById("dang_xieban").innerText;       // 协办科室
            var yb_ytnr = btoa(encodeURI(UE.getEditor("editor").getContent()));       // 议题内容
            var yb_ytyj = btoa(encodeURI(UE.getEditor("editor1").getContent()));       // 议题依据
            var yb_jjfa = btoa(encodeURI(UE.getEditor("editor2").getContent()));       // 解决方案
            var yb_ygys = document.getElementById("db_ygys").innerText;       // 预估用时(分钟)
            var ysje = document.getElementById("ysje").innerText;       // 预算金额
            var jfly = document.getElementById("jfly").innerText;       // 预算金额
            var nr_wenben = UE.getEditor("editor").getPlainTxt();
            var yj_wenben = UE.getEditor("editor1").getPlainTxt();
            var fa_wenben = UE.getEditor("editor2").getPlainTxt();
            var topic_type_select = document.getElementById("topic_type_select").value;         // 议题类型
            var pay_type_select = "";
            var contract_type_select = "";
            var whether_outweigh_20 = ""
            var Payee = "";
            var receiving_account = "";
            var opening_bank = "";
            var contract_name = "";                                         // 合同名称
            var contract_number = "";                                   // 合同编号
            var application_amount = "";                // 申请金额
            var amount_words = "";                          // 金额大写
            var funding_source = "";                    // 预算金额
            var whether_bid = "";
            var myselect = document.getElementById("fg_people");
            var index = myselect.selectedIndex;
            var fg_people = myselect.options[index].value;
            if (topic_type_select === "0") {
                alert("请选择议题类型！")
                return false
            }else {
                if (topic_type_select === "1") {
                    pay_type_select = document.getElementById("pay_type_select").value;
                    whether_outweigh_20 = $("input[type=radio][name=whether_outweigh_20]:checked").val();
                    Payee = document.getElementById("Payee").innerText;
                    receiving_account = document.getElementById("receiving_account").innerText;
                    opening_bank = document.getElementById("opening_bank").innerText;
                    application_amount = document.getElementById("application_amount").innerText;
                    amount_words = document.getElementById("amount_words").innerText;
                    funding_source = document.getElementById("funding_source").value;
                    if (pay_type_select === "0") {
                        alert("请选择付款类型！")
                        return false
                    }
                    if (!whether_outweigh_20) {
                        alert("请选择是否转党委会！")
                        return false
                    }
                    if (!Payee) {
                        alert("请填写收款单位！")
                        return false
                    }
                    if (!receiving_account) {
                        alert("请填写收款账号！")
                        return false
                    }
                    if (!opening_bank) {
                        alert("请填写开户行！")
                        return false
                    }
                    if (!application_amount) {
                        alert("请填写申请金额！")
                        return false
                    }
                    if (funding_source === "0") {
                        alert("请选择经费来源！")
                        return false
                    }
                }
                if (topic_type_select === "2") {
                    contract_type_select = document.getElementById("contract_type_select").value;
                    whether_outweigh_20 = $("input[type=radio][name=whether_outweigh_20]:checked").val();
                    Payee = document.getElementById("opposite_unit").innerText;
                    contract_name = document.getElementById("contract_name").innerText;
                    contract_number = document.getElementById("contract_number").innerText;
                    if (pay_type_select === "0") {
                        alert("请选择合同类型！")
                        return false
                    }
                    if (!whether_outweigh_20) {
                        alert("请选择是否转党委会！")
                        return false
                    }
                    if (!Payee) {
                        alert("请填写对方单位！")
                        return false
                    }
                    if (!contract_name) {
                        alert("请填写合同名称！")
                        return false
                    }
                    if (!contract_number) {
                        alert("请填写合同编号！")
                        return false
                    }
                }
                if (topic_type_select === "3") {
                    whether_bid = $("input[type=radio][name=whether_bid_or_not]:checked").val();
                    if (!whether_bid) {
                        alert("请选择是否招标！")
                        return false
                    }
                }
                if (topic_type_select === "7") {
                    whether_outweigh_20 = $("input[type=radio][name=whether_outweigh_20]:checked").val();
                    if (!yb_xb) {
                        alert("请选择协办科室！")
                        return false
                    }
                    if (!whether_outweigh_20) {
                        alert("请选择是否转党委会！")
                        return false
                    }
                }
            }
            if (CompanyId in [13, 3, 22]){
                if (!fg_people){
                    alert("请选择分管领导！");
                    return false
                }
            }
            if (!yb_ytmc){
                alert("议题名称不能为空");
                return false
            }
            if (!yb_ytnr){
                alert("议题内容不能为空");
                return false
            }
            if (!yb_jjfa){
                alert("解决方案不能为空");
                return false
            }

            var yb_xb_split = yb_xb.split(',');var yb_xb_list = [];
            if (yb_xb_split.length >= 1){
                for (var b=0; b<yb_xb_split.length; b++){
                    if (yb_xb_split[b].trim()){
                        yb_xb_list.push(yb_xb_split[b].split("(")[1].slice(0, -1));
                    }
                }
            }

            var yb_send_str = 'received_id={{ received_id }}&number='+String(yb_bh)+'&type='+String("yb")+'&topics_name='+String(yb_ytmc)+'&topics_text='+String(yb_ytnr)+'&topics_basis='+String(yb_ytyj)+'&solution='+String(yb_jjfa)+'&help_department='+JSON.stringify(yb_xb_list)+'&topics_estimate='+String(yb_ygys)+"&nr_wenben="+String(nr_wenben)+"&yj_wenben="+String(yj_wenben)+"&fa_wenben="+String(fa_wenben)+"&fg_people="+String(fg_people)+"&ysje="+String(ysje)+"&jfly="+String(jfly) +
                "&uuid=" + String(uuid) + "&topic_type_select="+String(topic_type_select) + "&pay_type_select="+String(pay_type_select) + "&whether_outweigh_20="+String(whether_outweigh_20) + "&Payee="+String(Payee) + "&receiving_account="+String(receiving_account) + "&opening_bank="+String(opening_bank) + "&contract_type_select="+String(contract_type_select) + "&contract_name="+String(contract_name) + "&contract_number="+String(contract_number)+
                "&application_amount="+String(application_amount)+ "&amount_words=" + String(amount_words) + "&funding_source=" + String(funding_source) + "&whether_bid=" + String(whether_bid);
            ajax_request(yb_send_str);
        }

        function summit_data2() {
            var lh_ytmc = document.getElementById("db_ytmc").innerText;       // 议题名称
            var lh_bh = document.getElementById("db_bh").innerText;       // 议题编号
            var lh_xb = document.getElementById("dang_xieban").innerText;       // 协办科室
            var lh_ytnr = btoa(encodeURI(UE.getEditor("editor").getContent()));       // 议题内容
            var lh_ygys = document.getElementById("db_ygys").innerText;       // 预估用时(分钟)
            var nr_wenben = UE.getEditor("editor").getPlainTxt();
            var myselect = document.getElementById("fg_people");
            var index = myselect.selectedIndex;
            var fg_people = myselect.options[index].value;
            if (CompanyId in [13, 3, 22]){
                if (!fg_people){
                    alert("请选择分管领导！");
                    return false
                }
            }
            if (!lh_ytmc){
                alert("议题名称不能为空");
                return false
            }
            if (!lh_ytnr){
                alert("议题内容不能为空");
                return false
            }
            var regular_table = document.getElementById('party_main');
            if (!regular_table.children.length){
                alert("请上传附件！");
                return false
            }
            var lh_send_str = 'number=' + String(lh_bh) + '&type=' + String("xz") + '&topics_name=' + String(lh_ytmc) + '&topics_text=' + String(lh_ytnr) + '&topics_estimate=' + String(lh_ygys) + "&nr_wenben=" + String(nr_wenben) + "&fg_people=" + String(fg_people) + "&uuid=" + String(uuid);
            ajax_request(lh_send_str);
        }

        function ajax_request(send_str) {
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/TopicsView", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send(send_str);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        if (JsonDate["code"] === 200){
                            alert("提交成功！");
                            window.location.href="/personal-center/topics_list_view";
                        }else {
                            alert(JsonDate["message"]);
                        }
                    }
                }
            };
        }

        function ajax_request1(send_str) {
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/topics_draft_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send(send_str);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        if (JsonDate["code"] === 200){
                            alert("保存成功！");
                            window.location.href="/personal-center/topics_list_view";
                        }else {
                            alert(JsonDate["message"]);
                        }
                    }
                }
            };
        }

        function save_data() {
            var db_ytmc = document.getElementById("db_ytmc").innerText;       // 议题名称
            var db_bh = document.getElementById("db_bh").innerText;       // 议题编号
            var db_xb = document.getElementById("dang_xieban").innerText;       // 协办科室
            var db_ytnr = btoa(encodeURI(UE.getEditor("editor").getContent()));       // 议题内容
            var db_ytyj = btoa(encodeURI(UE.getEditor("editor1").getContent()));       // 议题依据
            var db_jjfa = btoa(encodeURI(UE.getEditor("editor2").getContent()));       // 解决方案
            var db_ygys = document.getElementById("db_ygys").innerText;       // 预估用时(分钟)
            var ysje = document.getElementById("ysje").innerText;       // 预算金额
            var jfly = document.getElementById("jfly").innerText;       // 经费来源
            {#var audit_result = $("input[type=radio][name=yb_gh]:checked").val();            // 是否经过院长办公会#}
            var nr_wenben = UE.getEditor("editor").getPlainTxt();
            var yj_wenben = UE.getEditor("editor1").getPlainTxt();
            var fa_wenben = UE.getEditor("editor2").getPlainTxt();
            var myselect = document.getElementById("fg_people");
            var index = myselect.selectedIndex;
            var fg_people = myselect.options[index].value;

            var db_xb_split = db_xb.split(',');var db_xb_list = [];
            if (db_xb_split.length >= 1){
                for (var a=0; a<db_xb_split.length; a++){
                    if (db_xb_split[a].trim()){
                        db_xb_list.push(db_xb_split[a].split("(")[1].slice(0, -1));
                    }
                }
             }
            var db_send_str = 'number='+String(db_bh)+'&type='+String("db")+'&topics_name='+String(db_ytmc)+'&topics_text='+String(db_ytnr)+'&topics_basis='+String(db_ytyj)+'&solution='+String(db_jjfa)+'&help_department='+JSON.stringify(db_xb_list)+'&topics_estimate='+String(db_ygys)+"&nr_wenben="+String(nr_wenben)+"&yj_wenben="+String(yj_wenben)+"&fa_wenben="+String(fa_wenben)+"&fg_people="+String(fg_people)+"&ysje="+String(ysje)+"&jfly="+String(jfly) + "&uuid=" + String(uuid);
            ajax_request1(db_send_str);
        }

        function save_data1() {
            var yb_ytmc = document.getElementById("db_ytmc").innerText;       // 议题名称
            var yb_bh = document.getElementById("db_bh").innerText;       // 议题编号
            var yb_xb = document.getElementById("dang_xieban").innerText;       // 协办科室
            var yb_ytnr = btoa(encodeURI(UE.getEditor("editor").getContent()));       // 议题内容
            var yb_ytyj = btoa(encodeURI(UE.getEditor("editor1").getContent()));       // 议题依据
            var yb_jjfa = btoa(encodeURI(UE.getEditor("editor2").getContent()));       // 解决方案
            var yb_ygys = document.getElementById("db_ygys").innerText;       // 预估用时(分钟)
            var ysje = document.getElementById("ysje").innerText;       // 预算金额
            var jfly = document.getElementById("jfly").innerText;       // 预算金额
            var nr_wenben = UE.getEditor("editor").getPlainTxt();
            var yj_wenben = UE.getEditor("editor1").getPlainTxt();
            var fa_wenben = UE.getEditor("editor2").getPlainTxt();
            var myselect = document.getElementById("fg_people");
            var index = myselect.selectedIndex;
            var fg_people = myselect.options[index].value;
            var topic_type_select = document.getElementById("topic_type_select").value;         // 议题类型
            var pay_type_select = document.getElementById("pay_type_select").value;
            var whether_outweigh_20 = $("input[type=radio][name=whether_outweigh_20]:checked").val();
            var Payee = document.getElementById("Payee").innerText;
            var receiving_account = document.getElementById("receiving_account").innerText;
            var opening_bank = document.getElementById("opening_bank").innerText;
            var contract_type_select = document.getElementById("contract_type_select").value;
            var contract_name = document.getElementById("contract_name").innerText;
            var contract_number = document.getElementById("contract_number").innerText;
            var application_amount = document.getElementById("application_amount").innerText;
            var amount_words = document.getElementById("amount_words").innerText;
            var funding_source = document.getElementById("funding_source").value;
            var whether_bid = $("input[type=radio][name=whether_bid_or_not]:checked").val();
            var yb_xb_split = yb_xb.split(',');var yb_xb_list = [];
            if (yb_xb_split.length >= 1){
                for (var b=0; b<yb_xb_split.length; b++){
                    if (yb_xb_split[b].trim()){
                        yb_xb_list.push(yb_xb_split[b].split("(")[1].slice(0, -1));
                    }
                }
            }

            var yb_send_str = 'received_id={{ received_id }}&number='+String(yb_bh)+'&type='+String("yb")+'&topics_name='+String(yb_ytmc)+'&topics_text='+String(yb_ytnr)+'&topics_basis='+String(yb_ytyj)+'&solution='+String(yb_jjfa)+'&help_department='+JSON.stringify(yb_xb_list)+'&topics_estimate='+String(yb_ygys)+"&nr_wenben="+String(nr_wenben)+"&yj_wenben="+String(yj_wenben)+"&fa_wenben="+String(fa_wenben)+"&fg_people="+String(fg_people)+"&ysje="+String(ysje)+"&jfly="+String(jfly) +
                "&uuid=" + String(uuid) + "&topic_type_select="+String(topic_type_select) + "&pay_type_select="+String(pay_type_select) + "&whether_outweigh_20="+String(whether_outweigh_20) + "&Payee="+String(Payee) + "&receiving_account="+String(receiving_account) + "&opening_bank="+String(opening_bank) + "&contract_type_select="+String(contract_type_select) + "&contract_name="+String(contract_name) + "&contract_number="+String(contract_number) +
                "&application_amount=" + String(application_amount) + "&amount_words="+String(amount_words) + "&funding_source="+String(funding_source) + "&whether_bid=" + String(whether_bid);
            ajax_request1(yb_send_str);
        }

        function save_data2() {
            var lh_ytmc = document.getElementById("db_ytmc").innerText;       // 议题名称
            var lh_bh = document.getElementById("db_bh").innerText;       // 议题编号
            var lh_xb = document.getElementById("dang_xieban").innerText;       // 协办科室
            var lh_ytnr = btoa(encodeURI(UE.getEditor("editor").getContent()));       // 议题内容
            var lh_ygys = document.getElementById("db_ygys").innerText;       // 预估用时(分钟)
            var nr_wenben = UE.getEditor("editor").getPlainTxt();
            var myselect = document.getElementById("fg_people");
            var index = myselect.selectedIndex;
            var fg_people = myselect.options[index].value;

            var lh_send_str = 'number=' + String(lh_bh) + '&type=' + String("xz") + '&topics_name=' + String(lh_ytmc) + '&topics_text=' + String(lh_ytnr) + '&topics_estimate=' + String(lh_ygys) + "&nr_wenben=" + String(nr_wenben) + "&fg_people=" + String(fg_people) + "&uuid=" + String(uuid);
            ajax_request1(lh_send_str);
        }

        // 上传正文
        function upload_accessory(file_type, tbody_id, accessory_type, bh_id) {
            document.getElementById("loading").style.display = "inline-block";
            var form = new FormData();
            var files = document.getElementById(accessory_type).files[0];
            var ytbh = document.getElementById(bh_id).innerText;       // 议题编号
            form.append(file_type, files);
            form.append('number', uuid)
            form.append("source", "yt")
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/topics_attachments_upload", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        if (JsonDate["code"] === 400){
                            alert("请上传xlsx格式文件！")
                        }
                        creat_table(JsonDate, tbody_id);
                        document.getElementById("party_main_body").value="";
                    }
                }
            };
        }

        // 创建附件列表
        function creat_table(JsonData, tbody_id) {
            var t_table = document.getElementById(tbody_id);
            var local_host = window.location.host;
            if (Array.isArray(JsonData["pdf_path"])){
                for (var i=0; i<JsonData["pdf_path"].length; i++){
                    var tr = document.createElement("tr");
                    var td1 = document.createElement("td");var td2 = document.createElement("td");var td3 = document.createElement("td");var td4 = document.createElement("td");var td5 = document.createElement("td");var td6 = document.createElement("td");
                    td1.innerHTML = t_table.children.length+1;td1.style.textAlign = "center";td1.style.border="#cccccc solid 1px";td1.style.borderTop="none";
                    td2.innerHTML = JsonData["file_name"];td2.style.paddingLeft = "1%";td2.style.border="#cccccc solid 1px";td2.style.borderLeft="none";td2.style.borderTop="none";
                    td3.innerHTML = JsonData["file_size"];td3.style.textAlign = "center";td3.style.border="#cccccc solid 1px";td3.style.borderLeft="none";td3.style.borderTop="none";
                    td4.innerHTML = JsonData["upload_time"];td4.style.textAlign = "center";td4.style.border="#cccccc solid 1px";td4.style.borderLeft="none";td4.style.borderTop="none";
                    td5.innerHTML = JsonData["uploader"];td5.style.textAlign = "center";td5.style.border="#cccccc solid 1px";td5.style.borderLeft="none";td5.style.borderTop="none";
                    td6.innerHTML = "<a target='_blank' href='"+JsonData["pdf_path"][i]["pdf_path"] + "'>查看</a> | <a style='color: red;' href='#' onclick='RemoveTr(this, \""+tbody_id+"\", \""+JsonData["pdf_path"][i]["id"]+"\")'>删除</a>";td6.style.textAlign = "center";td6.style.border="#cccccc solid 1px";td6.style.borderLeft="none";td6.style.borderTop="none";
                    tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tr.appendChild(td4);tr.appendChild(td5);tr.appendChild(td6);
                    t_table.appendChild(tr);
                }
                if (JsonData["pdf_path"].length > 1){
                    document.getElementById("del_adjunct").style.display='block';
                }
            }else {
                var tr = document.createElement("tr");
                var td1 = document.createElement("td");var td2 = document.createElement("td");var td3 = document.createElement("td");var td4 = document.createElement("td");var td5 = document.createElement("td");var td6 = document.createElement("td");
                td1.innerHTML = t_table.children.length+1;td1.style.textAlign = "center";td1.style.border="#cccccc solid 1px";td1.style.borderTop="none";
                td2.innerHTML = JsonData["file_name"];td2.style.paddingLeft = "1%";td2.style.border="#cccccc solid 1px";td2.style.borderLeft="none";td2.style.borderTop="none";
                td3.innerHTML = JsonData["file_size"];td3.style.textAlign = "center";td3.style.border="#cccccc solid 1px";td3.style.borderLeft="none";td3.style.borderTop="none";
                td4.innerHTML = JsonData["upload_time"];td4.style.textAlign = "center";td4.style.border="#cccccc solid 1px";td4.style.borderLeft="none";td4.style.borderTop="none";
                td5.innerHTML = JsonData["uploader"];td5.style.textAlign = "center";td5.style.border="#cccccc solid 1px";td5.style.borderLeft="none";td5.style.borderTop="none";
                td6.innerHTML = "<a target='_blank' href='"+JsonData["pdf_path"] + "'>查看</a> | <a style='color: red;' href='#' onclick='RemoveTr(this, \""+tbody_id+"\", \""+JsonData["id"]+"\")'>删除</a>";td6.style.textAlign = "center";td6.style.border="#cccccc solid 1px";td6.style.borderLeft="none";td6.style.borderTop="none";
                tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tr.appendChild(td4);tr.appendChild(td5);tr.appendChild(td6);
                t_table.appendChild(tr);
            }
        }

        function RemoveTr(_this, tbody_id, wj_id) {
            var table = document.getElementById(tbody_id);
            var trNode = $(_this).parent().parent();
            trNode.remove();

            for (var i=0; i<table.children.length; i++){
                table.children[i].children[0].innerHTML=i+1;
            }

            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/delete_attachments_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send("id="+String(wj_id));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        alert("删除成功！")
                    }
                }
            };
        }

        function jianshu_show() {
            if (document.getElementById("yt_js").style.display === "none"){
                document.getElementById("yt_js").style.display="inline-block";
            }else {
                document.getElementById("yt_js").style.display="none";
            }
        }
        function yiju_show() {
            if (document.getElementById("yt_yj").style.display === "none"){
                document.getElementById("yt_yj").style.display="inline-block";
            }else {
                document.getElementById("yt_yj").style.display="none";
            }
        }
        function jiejuefangan_show() {
            if (document.getElementById("jj_fa_yj").style.display === "none"){
                document.getElementById("jj_fa_yj").style.display="inline-block";
            }else {
                document.getElementById("jj_fa_yj").style.display="none";
            }
        }

        function permissions_validation() {
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/system-setup/permissions_validation");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send();
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        permissions = JsonDate['permissions'];
                        if (permissions['院长办公会']){
                            document.getElementById("administrative_tag").className = "tab_top top_tag";
                            document.getElementById("regular_meeting_tag").className = "tab_top";
                            document.getElementById("party_committee_tag").className = "tab_top";
                            document.getElementById("title——yiti").innerText="院长办公会议题审批表";
                            document.getElementById("xieban_kehsi").style.display="table";
                            document.getElementById("zhengceyiju").style.display="table";
                            document.getElementById("jiejuefangan").style.display="table";
                            document.getElementById("db_bh").innerText = yb_Serial_number;
                            document.getElementById("summit_but").setAttribute("onclick", "summit_data1()");
                            document.getElementById("save_but").setAttribute("onclick", "save_data1()");
                            return false
                        }
                        if (permissions['党委会']){
                            document.getElementById("party_committee_tag").className = "tab_top top_tag";
                            document.getElementById("regular_meeting_tag").className = "tab_top";
                            document.getElementById("administrative_tag").className = "tab_top";
                            document.getElementById("title——yiti").innerText="党委会议题审批表";
                            document.getElementById("xieban_kehsi").style.display="table";
                            document.getElementById("zhengceyiju").style.display="table";
                            document.getElementById("jiejuefangan").style.display="table";
                            document.getElementById("db_bh").innerText = db_Serial_number;
                            document.getElementById("summit_but").setAttribute("onclick", "summit_data()");
                            document.getElementById("save_but").setAttribute("onclick", "save_data()");
                            return false
                        }
                        if (permissions['行政例会']){
                            document.getElementById("regular_meeting_tag").className = "tab_top top_tag";
                            document.getElementById("administrative_tag").className = "tab_top";
                            document.getElementById("party_committee_tag").className = "tab_top";
                            document.getElementById("title——yiti").innerText="行政例会议题审批表";
                            document.getElementById("xieban_kehsi").style.display="none";
                            document.getElementById("zhengceyiju").style.display="none";
                            document.getElementById("jiejuefangan").style.display="none";
                            document.getElementById("db_bh").innerText = lh_Serial_number;
                            document.getElementById("summit_but").setAttribute("onclick", "summit_data2()");
                            document.getElementById("save_but").setAttribute("onclick", "save_data2()");
                            return false
                        }
                    }
                }
             };
        }

        function select_topic_type() {
            var choose_type = document.getElementById("topic_type_select").value;
            if (choose_type === "1") {
                document.getElementById("topic_type").setAttribute("colspan", "1");
                document.getElementById("topic_type").style.width = "25%";
                document.getElementById("pay_type_title").style.display = "table-cell";
                document.getElementById("pay_type").style.display = "table-cell";
                document.getElementById("contract_type_title").style.display = "none";
                document.getElementById("contract_type").style.display = "none";
                document.getElementById("whether_outweigh_title").style.display = "table-cell";
                document.getElementById("whether_outweigh").style.display = "table-cell";
                document.getElementById("payment_information").style.display = "table-row";
                document.getElementById("contract_countersigning_tr").style.display = "none";
                document.getElementById("payment_capitalization").style.display = "table-row";
                document.getElementById("WhetherBidTitle").style.display = "none";
                document.getElementById("WhetherBid").style.display = "none";
                document.getElementById("ysje1").style.display = "none";
                document.getElementById("ysje").style.display = "none";
                document.getElementById("jfly1").style.display = "none";
                document.getElementById("jfly").style.display = "none";
                document.getElementById("dang_xieban").setAttribute("colspan", "5");
                document.getElementById("dang_xieban").style.width = "85%";
            }else if (choose_type === "2") {
                document.getElementById("topic_type").setAttribute("colspan", "1");
                document.getElementById("topic_type").style.width = "25%";
                document.getElementById("pay_type_title").style.display = "none";
                document.getElementById("pay_type").style.display = "none";
                document.getElementById("contract_type_title").style.display = "table-cell";
                document.getElementById("contract_type").style.display = "table-cell";
                document.getElementById("whether_outweigh_title").style.display = "table-cell";
                document.getElementById("whether_outweigh").style.display = "table-cell";
                document.getElementById("contract_countersigning_tr").style.display = "table-row";
                document.getElementById("WhetherBidTitle").style.display = "none";
                document.getElementById("WhetherBid").style.display = "none";
                document.getElementById("payment_information").style.display = "none";
                document.getElementById("payment_capitalization").style.display = "none";
                document.getElementById("ysje1").style.display = "table-cell";
                document.getElementById("ysje").style.display = "table-cell";
                document.getElementById("jfly1").style.display = "table-cell";
                document.getElementById("jfly").style.display = "table-cell";
                document.getElementById("dang_xieban").removeAttribute("colspan");
                document.getElementById("dang_xieban").style.width = "25%";
            }else if (choose_type === "3") {
                document.getElementById("topic_type").setAttribute("colspan", "3");
                document.getElementById("topic_type").style.width = "53%";
                document.getElementById("WhetherBidTitle").style.display = "table-cell";
                document.getElementById("WhetherBid").style.display = "table-cell";
                document.getElementById("pay_type_title").style.display = "none";
                document.getElementById("pay_type").style.display = "none";
                document.getElementById("contract_type_title").style.display = "none";
                document.getElementById("contract_type").style.display = "none";
                document.getElementById("whether_outweigh_title").style.display = "none";
                document.getElementById("whether_outweigh").style.display = "none";
                document.getElementById("payment_information").style.display = "none";
                document.getElementById("contract_countersigning_tr").style.display = "none";
                document.getElementById("payment_capitalization").style.display = "none";
                document.getElementById("ysje1").style.display = "table-cell";
                document.getElementById("ysje").style.display = "table-cell";
                document.getElementById("jfly1").style.display = "table-cell";
                document.getElementById("jfly").style.display = "table-cell";
                document.getElementById("dang_xieban").removeAttribute("colspan");
                document.getElementById("dang_xieban").style.width = "25%";
            }else if (choose_type === "7") {
                document.getElementById("topic_type").setAttribute("colspan", "3");
                document.getElementById("topic_type").style.width = "53%";
                document.getElementById("WhetherBidTitle").style.display = "none";
                document.getElementById("WhetherBid").style.display = "none";
                document.getElementById("pay_type_title").style.display = "none";
                document.getElementById("pay_type").style.display = "none";
                document.getElementById("contract_type_title").style.display = "none";
                document.getElementById("contract_type").style.display = "none";
                document.getElementById("whether_outweigh_title").style.display = "table-cell";
                document.getElementById("whether_outweigh").style.display = "table-cell";
                document.getElementById("payment_information").style.display = "none";
                document.getElementById("contract_countersigning_tr").style.display = "none";
                document.getElementById("payment_capitalization").style.display = "none";
                document.getElementById("ysje1").style.display = "table-cell";
                document.getElementById("ysje").style.display = "table-cell";
                document.getElementById("jfly1").style.display = "table-cell";
                document.getElementById("jfly").style.display = "table-cell";
                document.getElementById("dang_xieban").removeAttribute("colspan");
                document.getElementById("dang_xieban").style.width = "25%";
            }else {
                document.getElementById("topic_type").setAttribute("colspan", "5");
                document.getElementById("topic_type").style.width = "85%";
                document.getElementById("pay_type_title").style.display = "none";
                document.getElementById("pay_type").style.display = "none";
                document.getElementById("contract_type_title").style.display = "none";
                document.getElementById("contract_type").style.display = "none";
                document.getElementById("whether_outweigh_title").style.display = "none";
                document.getElementById("whether_outweigh").style.display = "none";
                document.getElementById("payment_information").style.display = "none";
                document.getElementById("WhetherBidTitle").style.display = "none";
                document.getElementById("WhetherBid").style.display = "none";
                document.getElementById("contract_countersigning_tr").style.display = "none";
                document.getElementById("payment_capitalization").style.display = "none";
                document.getElementById("ysje1").style.display = "table-cell";
                document.getElementById("ysje").style.display = "table-cell";
                document.getElementById("jfly1").style.display = "table-cell";
                document.getElementById("jfly").style.display = "table-cell";
                document.getElementById("dang_xieban").removeAttribute("colspan");
                document.getElementById("dang_xieban").style.width = "25%";
            }
        }

        function change_daxie(this_) {
            let reg = new RegExp("[\\u4E00-\\u9FFF]+","g")
            var application_amount = document.getElementById("application_amount").innerText;
            if(reg.test(application_amount)){
                alert("请输入纯数字！")
                return false
            }
            this_.innerText = formatMonenyNumber(application_amount.replace(",", '').replace(",", '').replace(",", '').replace(",", '').replace(",", ''))
            document.getElementById("amount_words").innerText=ToString(application_amount.replace(",", '').replace(",", '').replace(",", '').replace(",", '').replace(",", ''));
        }

        function formatMonenyNumber(number, toFixed = 2) {
            let str = [];
            if (!number) return 0
            if (typeof number === "number") number = String(number)
            let tempNumber = number.split('.');
            number = tempNumber[0]
            if (number.length <= 3) {
                if (tempNumber[1]) {
                    number += '.' + tempNumber[1].slice(0, toFixed);
                }else {
                    number += '.00'
                }
                return number
            }
            number.split('').reverse().forEach((item, index) => {
                if (index !== 0 && index % 3 === 0) {
                    str.push(',', item)
                } else {
                    str.push(item)
                }
            })
            number = str.reverse().join('')
            if (tempNumber[1]) {
                var decimils = tempNumber[1].slice(0, toFixed);
                if (decimils.length === 1){
                    decimils = decimils + "0";
                }
                number += '.' + decimils;
            }else {
                 number += '.00'
            }
            return number;
        }

        function ToString(money) {
            console.log(money, '执行了吗');
            //汉字的数字
            var cnNums = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
            //基本单位
            var cnIntRadice =['', '拾', '佰', '仟'];
            //对应整数部分扩展单位
            var cnIntUnits = ['', '万', '亿', '兆'];
            //对应小数部分单位
            var cnDecUnits = ['角', '分', '毫', '厘'];
            //整数金额时后面跟的字符
            var cnInteger = '整';
            //整型完以后的单位
            // var cnIntLast = '圆';
            var cnIntLast = '元';
            //最大处理的数字
            var maxNum = 999999999999999.9999;
            //金额整数部分
            var integerNum;
            //金额小数部分
            var decimalNum;
            //输出的中文金额字符串
            var chineseStr = '';
            //分离金额后用的数组，预定义
            var parts;
            if (money === '') { return ''; }
            money = parseFloat(money);
            if (money >= maxNum) {
                //超出最大处理数字
                return '';
            }
            if (money === 0) {
                chineseStr = cnNums[0] + cnIntLast + cnInteger;

                return chineseStr;
            }

            //转换为字符串
            money = money.toString();

            if (money.indexOf('.') === -1) {
                integerNum = money;
                decimalNum = '';
            } else {
                parts = money.split('.');
                integerNum = parts[0];

                decimalNum = parts[1].substring(0, 2);
            }
            //获取整型部分转换
            if (parseInt(integerNum, 10) > 0) {
                var zeroCount = 0;
                var IntLen = integerNum.length;
                for (var i = 0; i < IntLen; i++) {
                    // var n = integerNum.substr(i, 1);
                    var n = integerNum.substring(i, i+1);
                    var p = IntLen - i - 1;
                    var q = p / 4;
                    var m = p % 4;
                    if (n === '0') {
                        zeroCount++;
                    } else {
                        if (zeroCount > 0) {
                            chineseStr += cnNums[0];
                        }
                        //归零
                        zeroCount = 0;
                        chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
                    }
                    if (m === 0 && zeroCount < 4) {
                        chineseStr += cnIntUnits[q];
                    }
                }
                chineseStr += cnIntLast;
            }
            //小数部分
            if (decimalNum !== '') {
                var decLen = decimalNum.length;
                for (var i = 0; i < decLen; i++) {
                    // var n = decimalNum.substr(i, 1);
                    var n = decimalNum.substring(i, i+1);
                    if (n !== '0') {
                        // chineseStr += cnNums[Number(n)] + cnDecUnits[i];
                        chineseStr += cnNums[parseInt(n)] + cnDecUnits[i];
                    }
                }
            }
            if (chineseStr === '') {
                chineseStr += cnNums[0] + cnIntLast + cnInteger;
            } else if (decimalNum === '') {
                chineseStr += cnInteger;
            }

            return chineseStr;
        }
    </script>
{% endblock %}
